/*
 *  (c) 2015 fullhan.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

/*****************************************************************************
 *  Include Section
 *  add all #include here
 *****************************************************************************/
#include <common.h>
#include <command.h>
#include <net.h>
#include <malloc.h>
#include <linux/compiler.h>
#include <phy.h>
#include "tuning_lib.h"
/*****************************************************************************
 * Define section
 * add all #define here
 *****************************************************************************/
#define LOOP_OK					0
#define LOOP_ERR_SEND 			1
#define LOOP_ERR_REV_TIMEOUT 	2
#define LOOP_ERR_REV_ERR 		3
#define LOOP_ERR_REV_LEN 		4
#define LOOP_ERR_CMP 			5


#define DLL_POL_FWD 0
#define DLL_POL_REV 1


struct pol_dll_ret {
	u32 tx_pol;
	u32 rx_pol;
	u32 tx_dll;
	u32 rx_dll;
	char *result;
};

int pre_tuning_pol(struct eth_device *p_eth, struct phy_device *p_phy, u32 spd);
int auto_tx_dll_rec(struct eth_device *p_eth, struct phy_device *p_phy, u32 spd, struct pol_dll_ret *usr_ret);
int auto_rx_dll_rec(struct eth_device *p_eth, struct phy_device *p_phy, u32 spd, struct pol_dll_ret *usr_ret);

